<template>
  <div class="step-form-wrapper">
    <el-form :inline="true" :model="filter" class="product-filter-form">
      <el-form-item label="所属品牌">
        <el-select v-model="filter.brand" placeholder="请选择品牌" style="width: 150px;">
          <el-option label="雅诗兰黛" value="estee" />
        </el-select>
      </el-form-item>
      <el-form-item label="产品类型">
        <el-select v-model="filter.type" placeholder="请选择类型" style="width: 150px;">
          <el-option label="单品" value="single" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" :icon="Search">导入</el-button>
        <el-button type="primary" class="add-btn" :icon="Plus">添加</el-button>
      </el-form-item>
    </el-form>

    <div class="product-table-wrapper">
      <div class="table-actions">
        <el-checkbox v-model="checkAll" label="全选" />
        <el-button type="text" class="batch-op-btn">批量操作</el-button>
      </div>

      <el-table :data="tableData" border style="width: 100%" class="data-table">
        <el-table-column type="selection" />
        <el-table-column prop="id" label="序号"   />
        <el-table-column prop="productNumber" label="产品编号"   />
        <el-table-column prop="productName" label="产品名称" />
        <el-table-column prop="brand" label="所属品牌"   />
        <el-table-column prop="unit" label="规格"   />
        <el-table-column prop="type" label="类型"   />
        <el-table-column prop="costPrice" label="成本价"  />
        <el-table-column prop="inventory" label="库存"  />
        <el-table-column prop="sellingPrice" label="销售价"   />
        <el-table-column prop="remark" label="备注" />
        <el-table-column label="操作"  width="170">
          <template #default>
            <el-button   class="op-btn-danger">修改</el-button>
            <el-button   class="op-btn-primary">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <div class="bottom-nav">
      <el-button @click="emit('prev')" class="prev-btn">上一步</el-button>
      <el-button type="success" @click="handleNext" class="next-btn">下一步</el-button>
    </div>
  </div>
</template>

<script setup>
import { ref, defineEmits } from 'vue';
import { Search, Plus } from '@element-plus/icons-vue';

const emit = defineEmits(['next', 'prev']);
const filter = ref({ brand: '', type: '' });
const checkAll = ref(false);
const tableData = ref([
  { id: 1, productNumber: '67878', productName: '雅诗兰黛倾慕口红', brand: '雅诗兰黛', unit: '1', type: '单品', costPrice: '¥8080', inventory: 0, sellingPrice: '¥720', remark: '' },
  { id: 2, productNumber: '67878', productName: '雅诗兰黛倾慕口红', brand: '雅诗兰黛', unit: '1', type: '单品', costPrice: '¥8080', inventory: 0, sellingPrice: '¥720', remark: '' },
]);
const handleNext = () => { emit('next'); };
</script>

<style scoped>
/* 通用样式 */
.bottom-nav {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
}

.prev-btn {
  background-color: #fff;
  color: #333;
  border: 1px solid #ccc;
}

.next-btn {
  background-color: #55b95a;
  border-color: #55b95a;
}

/* 产品特定样式 */
.product-filter-form {
  padding: 10px 0 20px;
  border-bottom: 1px solid #eee;
}

.add-btn {
  background-color: #55b95a;
  border-color: #55b95a;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 15px 0;
}

.batch-op-btn {
  color: #409eff;
}

/* 操作按钮样式 (图片中的红/蓝实心按钮) */
.op-btn-danger {
  background-color: #f56c6c;
  border-color: #f56c6c;
  color: #fff;
  margin-right: 5px;
}

.op-btn-primary {
  background-color: #409eff;
  border-color: #409eff;
  color: #fff;
}
</style>